<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width,user-scalable=0"/>
    <meta charset="UTF-8">
    <title>确认预约</title>
    <script src="__api__/js/fontSize.js"></script>
    <script src="__api__/js/jquery-3.2.1.min.js"></script>
    <link rel="stylesheet" href="__api__/css/bootstrap.min.css">
    <link rel="stylesheet" href="__api__/css/reset.css">
    <link rel="stylesheet" href="__api__/css/my_main.css">
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
    <script>
        var date = localStorage.getItem('date');
        var data = eval('('+localStorage.getItem('qixi')+')');
        var dataClean = [];

        data.forEach(function(item,index){
            if(item){
                dataClean.push({
                    time:index,
                    qixi:item.qixi,
                    course:item.course
                });
            }
        });
        //todo 原始数据
        console.log(dataClean);
        var app = angular.module('myApp',[]);
        app.controller('myCtrl',function($scope){
            $scope.date = date;
            $scope.data = dataClean;
        });
        setTimeout(()=>{makeSelect()},500);
        var startime = dataClean[0].time;
        var endtime = dataClean[0].time+1;
        var postObj = {
            place_id:1,//todo 需要取值
            riqi:date,
            appoint_fee:dataClean[0].qixi.fee,
            appoint_time:startime+':00-'+endtime+':00',
            startime:startime+":00",
            endtime:endtime+":00",
            dongjie:''
        }
        console.log(postObj);
        var postData = JSON.stringify(postObj);
        console.log(postData);
        /*$('#go').click(function(){
            console.log('g');
            $.post('./json.html',{date:date,qixi:qixi,course:course},function(result){
                console.log(result);
            });
        });*/
    </script>
</head>
<body>
<div class="confirm" ng-app="myApp">
    <div class="container">
        <div class="confirm_box1">
            <div class="row">
                <div class="col-xs-4 col-md-4">
                    <div class="con_img">
                        <img src="__api__/{$res.img}">
                    </div>
                </div>
                <div class="col-xs-8 col-md-8" style="padding: 0;">
                    <div class="conBox1_text">
                        <h3>{$res.designation}</h3>
                        <div class="star">
                            <img src="__api__/images/star.png">
                        </div>
                        <div class="conf_other">
                            <div class="con_item">
                                <span>{empty name="res.wifi"}
不提供wifi
{else /}
wifi
{/empty}

                                </span>
                            </div>
                            <div class="con_item" style="margin-left: 0.18rem;">
                                <span>{$res.business_hours}</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="confirm_box2">
            <div class="conBox2_text" ng-controller="myCtrl">
                <p class="sel-text">你预约{{date}}该场馆：</p>
                <div class="sel" ng-repeat="x in data">
                    <span class="time">{{x.time}}:00~{{x.time+1}}:00</span>
                    <select class="ui-choose" multiple="multiple">
                        <option value="a" selected disabled>器械(含场地位)</option>
                        <option value="b" selected disabled ng-repeat="y in x.course" ng="">课程</option>
                    </select>
                </div>
                <p class="sel_text">本次预约需支付定金<span class="text_color">20</span>元，将从您的押金中扣除。</p>
            </div>

            <div class="con_btn">
                <a href="./success.html" id="go" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-sm">确认预约</a>
                <!--预约成功弹框-->
                <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
                    <div class="modal-dialog modal-sm" role="document">
                        <div class="modal-content">
                            预约成功
                        </div>
                    </div>
                </div>
            </div>

            <!--余额不足弹框-->
            <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-body">
                            <p>您的押金账户不足99元，充值后即刻开启健身模式！</p>
                        </div>
                        <div class="modal-footer">
                            <a href="javascript:" class="btn btn-default" data-dismiss="modal">先等会</a>
                            <a href="javascript:" class="btn btn-primary">去充值</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="con_note">
                <p>注：预定成功后，如您在预约开始时间前10分钟提出撤销申请，则定金可以退回账户；否则定金将不予退回。</p>
            </div>
        </div>
    </div>
   
</div>

<script src="__api__/js/jquery-3.2.1.min.js"></script>
<script src="__api__/js/bootstrap.min.js"></script>
<script src="__api__/js/ui-choose.js"></script>
<script src="__api__/js/selected.js"></script>
</body>
</html>